package com.wz.project.outStock.stockoutdetail.service.impl;

import java.util.List;

import com.wz.project.outStock.stockoutdetail.mapper.OutStockoutDetailFinishMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wz.project.outStock.stockoutdetail.mapper.OutStockoutDetailMapper;
import com.wz.project.outStock.stockoutdetail.domain.OutStockoutDetail;
import com.wz.project.outStock.stockoutdetail.service.IOutStockoutDetailService;
import com.wz.common.utils.text.Convert;

/**
 * 出库单据子表Service业务层处理
 * 
 * @author wz
 * @date 2022-09-08
 */
@Service
public class OutStockoutDetailServiceImpl implements IOutStockoutDetailService 
{
    @Autowired
    private OutStockoutDetailMapper outStockoutDetailMapper;
    @Autowired
    private OutStockoutDetailFinishMapper outStockoutDetailFinishMapper;

    /**
     * 查询出库单据子表
     * 
     * @param stockoutDetailId 出库单据子表ID
     * @return 出库单据子表
     */
    @Override
    public OutStockoutDetail selectOutStockoutDetailById(String stockoutDetailId)
    {
        return outStockoutDetailMapper.selectOutStockoutDetailById(stockoutDetailId);
    }

    /**
     * 查询出库单据子表列表
     * 
     * @param outStockoutDetail 出库单据子表
     * @return 出库单据子表
     */
    @Override
    public List<OutStockoutDetail> selectOutStockoutDetailList(OutStockoutDetail outStockoutDetail)
    {
        if(Integer.valueOf(outStockoutDetail.getStatus())<5){
        return outStockoutDetailMapper.selectOutStockoutDetailList(outStockoutDetail);}
        else{
            return outStockoutDetailFinishMapper.selectOutStockoutDetailFinishList(outStockoutDetail);
        }
    }

    /**
     * 新增出库单据子表
     * 
     * @param outStockoutDetail 出库单据子表
     * @return 结果
     */
    @Override
    public int insertOutStockoutDetail(OutStockoutDetail outStockoutDetail)
    {
        return outStockoutDetailMapper.insertOutStockoutDetail(outStockoutDetail);
    }

    /**
     * 修改出库单据子表
     * 
     * @param outStockoutDetail 出库单据子表
     * @return 结果
     */
    @Override
    public int updateOutStockoutDetail(OutStockoutDetail outStockoutDetail)
    {
        return outStockoutDetailMapper.updateOutStockoutDetail(outStockoutDetail);
    }

    /**
     * 删除出库单据子表对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteOutStockoutDetailByIds(String ids)
    {
        return outStockoutDetailMapper.deleteOutStockoutDetailByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除出库单据子表信息
     * 
     * @param stockoutDetailId 出库单据子表ID
     * @return 结果
     */
    @Override
    public int deleteOutStockoutDetailById(String stockoutDetailId)
    {
        return outStockoutDetailMapper.deleteOutStockoutDetailById(stockoutDetailId);
    }

    @Override
    public void updateOutStockoutDetailBYId(String stockoutDetailId) {
        outStockoutDetailMapper.updateOutStockoutDetailBYId(stockoutDetailId);
    }
}
